Skip to content

Conversation

@lennessyy
Copy link
Contributor

@lennessyy lennessyy commented Nov 13, 2025

What does this PR do?

  • Add TS to envconfig documentation

Notes to reviewers

@vercel
Copy link

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
temporal-documentation Ready Ready Preview Comment Nov 14, 2025 10:10pm

@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

📖 Docs PR preview links

@lennessyy lennessyy changed the title Ts envconfig docs: add TS to envconfig Nov 13, 2025
@lennessyy lennessyy marked this pull request as ready for review November 14, 2025 01:29
@lennessyy lennessyy requested a review from a team as a code owner November 14, 2025 01:29
Comment on lines 351 to 365
// The 'staging' profile in config.toml has an incorrect address (localhost:9999)
// We'll programmatically override it to the correct address

// Load the 'staging' profile.
const config = loadClientConnectConfig({
profile: profileName,
configSource: { path: configFile },
});

// Override the target host to the correct address.
// This is the recommended way to override configuration values.
config.connectionOptions.address = 'localhost:7233';

console.log(`\nLoaded '${profileName}' profile from ${configFile} with overrides.`);
console.log(` Address: ${config.connectionOptions.address} (overridden from localhost:9999)`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to do this override bit, I would follow the simpler sample here, imo.

Comment on lines 642 to 658
console.log("--- Loading 'staging' profile with programmatic overrides ---");

const configFile = resolve(__dirname, '../config.toml');
const profileName = 'staging';

// The 'staging' profile in config.toml has an incorrect address (localhost:9999)
// We'll programmatically override it to the correct address

// Load the 'staging' profile.
const config = loadClientConnectConfig({
profile: profileName,
configSource: { path: configFile },
});

// Override the target host to the correct address.
// This is the recommended way to override configuration values.
config.connectionOptions.address = 'localhost:7233';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - unless we explicitly want to document this and have precedent
That being said - I still think we don't need to demonstrate this twice, I think we typically have one simpler sample than a more complex one with the override?

Comment on lines +137 to +167
async function main() {
console.log('--- Loading default profile from config.toml ---');

// For this sample to be self-contained, we explicitly provide the path to
// the config.toml file included in this directory.
// By default though, the config.toml file will be loaded from
// ~/.config/temporalio/temporal.toml (or the equivalent standard config directory on your OS).
const configFile = resolve(__dirname, '../config.toml');

// loadClientConnectConfig is a helper that loads a profile and prepares
// the configuration for Connection.connect and Client. By default, it loads the
// "default" profile.
const config = loadClientConnectConfig({
configSource: { path: configFile },
});

console.log(`Loaded 'default' profile from ${configFile}.`);
console.log(` Address: ${config.connectionOptions.address}`);
console.log(` Namespace: ${config.namespace}`);
console.log(` gRPC Metadata: ${JSON.stringify(config.connectionOptions.metadata)}`);

console.log('\nAttempting to connect to client...');
try {
const connection = await Connection.connect(config.connectionOptions);
const client = new Client({ connection, namespace: config.namespace });
console.log('✅ Client connected successfully!');
await connection.close();
} catch (err) {
console.log(`❌ Failed to connect: ${err}`);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I would use as a simpler sample, for my previous comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants